import React,{ Component } from "react";
import { View,Text,Button,TextInput,StyleSheet } from "react-native";

export default class page3 extends Component {
    constructor(props){
        super(props);
    }
    static navigationOptions = {
        title:"我的page3"
    };
    render(){
        const { navigation } = this.props;
        const { state,setParams } = navigation;
        const { params } = state;
        const Showtext = params.mode==="edit"?'正在编辑':'保存';
        return (
            <View>
                <Text>我的page3</Text>
                <Button onPress={()=>{
                    navigation.goBack();
                }} title="GoBack"/>
                <TextInput style={ styles.titleInput } onChangeText = {text=>{
                    setParams({ title:text })
                }} />
                <Text>{ Showtext } </Text>
            </View>
        )
    }
}

const styles = StyleSheet.create({
    titleInput:{
        height:50,
        borderWidth: 1,
        marginTop: 20,
        borderColor:'black',
    }
});